package com.bx.user;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * com.bx.user.User: nutej
 * Date: Jan 16, 2008
 * Time: 10:07:02 AM
 */
public class UserDAO extends HibernateDaoSupport {

    public User getRecord(Long id) {
        return (User) getHibernateTemplate().get(User.class, id);
    }

    public List getRecords() {
        return getHibernateTemplate().find("from User");
    }

    public void saveRecord(User record) {
        getHibernateTemplate().saveOrUpdate(record);
    }

    public void removeRecord(Long id) {
        Object record = getHibernateTemplate().load(User.class, id);
        getHibernateTemplate().delete(record);
    }
}